Early on, search was based on a list of terms, which was like a set
of tags, in that terms were OR'd, and that order didn't matter. As
such, modifying any one of the terms wouldn't produce new results.
Nowadays, providers take the order into account, so a substring
should only be the case if new terms are added to the end.
https://bugzilla.gnome.org/show_bug.cgi?id=693935
if (!terms)
return;
- let isSubSearch = terms.length == this._previousTerms.length;
- if (isSubSearch) {
- for (let i = 0; i < terms.length; i++) {
- if (terms[i].indexOf(this._previousTerms[i]) != 0) {
- isSubSearch = false;
- break;
- }
- }
- }
+ let searchString = terms.join(' ');
+ let previousSearchString = this._previousTerms.join(' ');
+
+ let isSubSearch = false;
+ if (this._previousTerms.length > 0)
+ isSubSearch = searchString.indexOf(previousSearchString) == 0;
let previousResultsArr = this._previousResults;